home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / TURBOPASCAL WIN / OWLDEMOS.PAK / FILEAPP.PAS < prev    next >
Pascal/Delphi Source File  |  1992-06-08  |  2KB  |  59 lines

  1. {************************************************}
  2. {                                                }
  3. {   Turbo Pascal for Windows                     }
  4. {   Demo program                                 }
  5. {   Copyright (c) 1991 by Borland International  }
  6. {                                                }
  7. {************************************************}
  8.  
  9. program FileEditor;
  10.  
  11. uses WObjects, WinTypes, WinProcs, StdWnds;
  12.  
  13. type
  14.  
  15.   { Declare TFileApp, a TApplication descendant }
  16.   TFileApp = object(TApplication)
  17.     procedure InitMainWindow; virtual;
  18.     procedure InitInstance;  virtual;
  19.   end;
  20.  
  21.   { Declare TMyFileWindow, a TFileWindow descendant }
  22.   PMyFileWindow = ^TMyFileWindow;
  23.   TMyFileWindow = object(TFileWindow)
  24.     constructor Init(AParent: PWindowsObject; ATitle: PChar);
  25.   end;
  26.  
  27. { Construct a TMyFileWindow, loading its menu }
  28. constructor TMyFileWindow.Init(AParent: PWindowsObject; ATitle: PChar);
  29. begin
  30.   TFileWindow.Init(AParent, ATitle, nil);
  31.   Attr.Menu := LoadMenu(HInstance, 'FileCommands');
  32. end;
  33.  
  34. { Construct the TFileApp's MainWindow of type TMyEditWindow }
  35. procedure TFileApp.InitMainWindow;
  36. begin
  37.   MainWindow := new(PMyFileWindow, Init(nil, 'File Window'));
  38. end;
  39.  
  40. { Initialize each MS-Windows application instance, loading an
  41.   accelerator table }
  42. procedure TFileApp.InitInstance;
  43. begin
  44.   TApplication.InitInstance;
  45.   if Status = 0 then
  46.     HAccTable := LoadAccelerators(HInstance, 'FileCommands');
  47. end;
  48.  
  49. { Declare a variable of type TFileApp }
  50. var
  51.   FileApp: TFileApp;
  52.  
  53. { Run the FileApp }
  54. begin
  55.   FileApp.Init('FileApp');
  56.   FileApp.Run;
  57.   FileApp.Done;
  58. end.
  59.